import http from "@/utils/http";

/**
 * @description: 获取当前用户的收藏夹
 * @param {*}
 * @return {*}
 */

export const findFavoriteByIdAPI = (id) => {
    return http.get('/favorite/findById', {
        params: { id }
    });
}

/**
 * @description: 获取当前商品的总收藏数
 * @param {*}
 * @return {*}
 */
export const findFavoriteCountAPI = (productId) => {
    return http.get('/favorite/findCount', {
        params: { productId }
    });
}

/**
 * @description: 根据data对象进行新增收藏夹
 * @param {data} 用户对象
 * @return {*}
 */
export function insertFavoriteAPI(data){
    return http.post('/favorite/addFavorite',data);
}

/**
 * @description: 取消收藏
 * @param {*}
 * @return {*}
 */
export const delFavoriteAPI = (userId,productId) => {
    return http.get('/favorite/deleteById', {
        params: { userId,productId }
    });
}